home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: XSLT
- Sub-category: xsl:output
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylesheet processes a set of XML elements and displays
- the result in HTML. This is accomplished using the output
- method of HTML.
- =============================================================== -->
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="html" />
-
- <xsl:template match="/">
- <html>
- <head>
- <title>Stylesheet Example</title>
- <style type="text/css"><![CDATA[
- H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
- TD {COLOR: darkblue; FONT-FAMILY: Arial}
- TR { background-color: beige; }
- BODY { background-color: beige; }
- ]]></style>
- </head>
- <body>
- <xsl:apply-templates />
- </body>
- </html>
- </xsl:template>
-
- <!-- Template for "employees" elements -->
- <xsl:template match="employees">
- <h1>Displaying Employees with output as HTML</h1>
- <!-- Table Header Creation -->
- <table border="1">
- <tr>
- <th>Department</th>
- <th>Name</th>
- <th>Hourly Rate</th>
- <th>Programming Language</th>
- </tr>
- <xsl:for-each select="employee">
- <tr>
- <td>
- <xsl:value-of select="department" />
- </td>
- <td>
- <xsl:value-of select="employeename" />
- </td>
- <td>
- <xsl:value-of select="hourlyrate" />
- </td>
- <td>
- <xsl:value-of select="primarylanguage" />
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
- </xsl:stylesheet>